package com.itheima.usermanager1.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.itheima.usermanager1.mapper.UserMapper;
import com.itheima.usermanager1.pojo.EasyUIPageBean;
import com.itheima.usermanager1.pojo.User;
import com.itheima.usermanager1.service.UserService;

@Service
public class UserServiceImpl implements UserService {

	@Autowired
	private UserMapper userMapper;
	
	@Override
	public EasyUIPageBean queryUserListByPage(Integer pageNum, Integer pageSize) {
		EasyUIPageBean easyUIPageBean = new EasyUIPageBean();
		PageHelper.startPage(pageNum, pageSize);
		List<User> list = userMapper.queryUserList();
		PageInfo<User> page = new PageInfo<User>(list);
		System.out.println(list);
		easyUIPageBean.setTotal(page.getTotal());
		easyUIPageBean.setRows(page.getList());
		return easyUIPageBean;
	}

}
